package com.iplant.wms.service.po.bill;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.iplant.base.po.BasePO;
import com.iplant.base.po.enums.DBSchemas;
import com.iplant.base.utils.annotation.field.DBField;
import com.iplant.base.utils.annotation.condition.DBCondition;
import com.iplant.base.utils.annotation.join.DBJoin;
import com.iplant.base.utils.annotation.join.multi.select.DBJoinMultiSelect;
import com.iplant.base.utils.annotation.po.DBBasePO;
import com.iplant.wms.service.basicenum.wms.WMSSalesDeliveryStatus;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;

/**
 * 销售发货单
 */
@DBBasePO(TableName = "wms_salesdelivery", Name = false, Active = false,
        CheckName = {"Code"}, Schemas = DBSchemas.WMS, CodeAuto = true,
        CodePrefix = "SDG{yyMM}-")
public class WMSSalesDelivery extends BasePO implements Serializable {
    private static final long serialVersionUID = 1L;


    @DBCondition
    @DBField(Update = false)
    public int FactoryID = 0;

    @DBJoin(name = "Code", tableName = "fmc_factory", tableAsName = "f1",
            Schemas = DBSchemas.Basic, MainTableField = "FactoryID")
    public String FactoryCode = "";

    @DBJoin(name = "Name", tableName = "fmc_factory", tableAsName = "f1",
            Schemas = DBSchemas.Basic, MainTableField = "FactoryID")
    public String FactoryName = "";

    /**
     * 发货时间  发货后会更改此值
     */
    @DBCondition(CompareType = DBCondition.DBCompareType.geLe, ParamName = "DeliveryTimeStart", ParamName2 = "DeliveryTimeEnd")
    @DBField
    public Calendar DeliveryTime = Calendar.getInstance();
    /**
     * 收货单位
     */
    @DBField
    public String Consignee = "";
    /**
     * 收货地址
     */
    @DBField
    public String AddressShip = "";
    /**
     * 联系人
     */
    @DBField
    public String Contact = "";
    /**
     * 电话
     */
    @DBField
    public String Telephone = "";
    /**
     * 备注
     */
    @DBField
    public String Remark = "";
    /**
     * 状态ID
     */
    @DBCondition(CompareType = DBCondition.DBCompareType.in)
    @DBField
    public int Status = 0;
    /**
     * 状态文本
     */
    public String StatusText = "";
    /**
     * 发货产品明细
     */
    @DBJoinMultiSelect(OutTableField = "SalesDeliveryID", ItemClazz = WMSSalesDeliveryItem.class)
    public List<WMSSalesDeliveryItem> ItemList = new ArrayList<>();


    /**
     * 发货人ID
     */
    @DBCondition
    @DBField
    public int SenderID = 0;
    /**
     * 发货人名称
     */
    @DBJoin(name = "Name", tableName = "mbs_user", tableAsName = "u3", Schemas = DBSchemas.Basic, MainTableField =
            "SenderID")
    public String SenderName = "";
    /**
     * 发货时刻
     */
    @DBCondition(CompareType = DBCondition.DBCompareType.geLt, ParamName = "SenderTimeStart", ParamName2 = "SenderTimeEnd")
    @DBField
    public Calendar SenderTime = Calendar.getInstance();
    /**
     * 分拣流水号
     */
    @DBField
    public String SortingSerialNumber = "";
    /**
     * 物流单号
     */
    @DBCondition
    @DBField
    public String ShipmentNumber = "";
    /**
     * 快递公司ID
     */
    @DBCondition
    @DBField
    public int CRMExpressCorpID = 0;
    /**
     * 快递公司名称
     */
    @DBJoin(name = "Name", tableName = "crm_expresscorp", tableAsName = "ce1", Schemas = DBSchemas.WMS, MainTableField =
            "CRMExpressCorpID")
    public String CRMExpressCorpName = "";
    /**
     * 快递公司编号
     */
    @DBJoin(name = "Code", tableName = "crm_expresscorp", tableAsName = "ce1", Schemas = DBSchemas.WMS, MainTableField =
            "CRMExpressCorpID")
    public String CRMExpressCorpCode = "";


    /**
     * U8销售发货单ID
     */
    @DBCondition
    @DBField
    public int U8_BillID = 0;
    /**
     * U8销售发货单号
     */
    @DBCondition
    @DBField
    public String U8_BillCode = "";


    /**
     * 销售单ID
     */
    @DBCondition
    @DBField
    public int PurchaseOrderID = 0;
    /**
     * 销售单号
     */
    @DBCondition
    @DBField
    public String PurchaseOrderCode = "";

    /**
     * 销售类别
     */
    @DBField
    public String cVouchType = "";

    /**
     * 销售类型
     */
    @DBField
    public String cSTCode = "";


    /**
     * 收发类别
     */
    @DBField
    public String cRdCode = "";


    /**
     * 销售业务
     */
    @DBField
    public String cBusType = "";

    @JsonProperty("Consignee")
    public String getConsignee() {
        return Consignee;
    }

    public void setConsignee(String consignee) {
        Consignee = consignee;
    }

    @JsonProperty("AddressShip")
    public String getAddressShip() {
        return AddressShip;
    }

    public void setAddressShip(String addressShip) {
        AddressShip = addressShip;
    }

    @JsonProperty("Contact")
    public String getContact() {
        return Contact;
    }

    public void setContact(String contact) {
        Contact = contact;
    }

    @JsonProperty("Telephone")
    public String getTelephone() {
        return Telephone;
    }

    public void setTelephone(String telephone) {
        Telephone = telephone;
    }

    @JsonProperty("Remark")
    public String getRemark() {
        return Remark;
    }

    public void setRemark(String remark) {
        Remark = remark;
    }

    @JsonProperty("Status")
    public int getStatus() {
        return Status;
    }

    public void setStatus(int status) {
        Status = status;
    }

    @JsonProperty("StatusText")
    public String getStatusText() {

        StatusText = WMSSalesDeliveryStatus.getEnumType(Status).getLabel();
        return StatusText;
    }

    public void setStatusText(String statusText) {
        StatusText = statusText;
    }

    @JsonProperty("ItemList")
    public List<WMSSalesDeliveryItem> getItemList() {
        return ItemList;
    }

    public void setItemList(List<WMSSalesDeliveryItem> itemList) {
        ItemList = itemList;
    }


    @JsonProperty("SenderID")
    public int getSenderID() {
        return SenderID;
    }

    public void setSenderID(int senderID) {
        SenderID = senderID;
    }

    @JsonProperty("SenderName")
    public String getSenderName() {
        return SenderName;
    }

    public void setSenderName(String senderName) {
        SenderName = senderName;
    }

    @JsonProperty("SenderTime")
    public Calendar getSenderTime() {
        return SenderTime;
    }

    public void setSenderTime(Calendar senderTime) {
        SenderTime = senderTime;
    }

    @JsonProperty("SortingSerialNumber")
    public String getSortingSerialNumber() {
        return SortingSerialNumber;
    }

    public void setSortingSerialNumber(String sortingSerialNumber) {
        SortingSerialNumber = sortingSerialNumber;
    }

    @JsonProperty("ShipmentNumber")
    public String getShipmentNumber() {
        return ShipmentNumber;
    }

    public void setShipmentNumber(String shipmentNumber) {
        ShipmentNumber = shipmentNumber;
    }

    @JsonProperty("CRMExpressCorpID")
    public int getCRMExpressCorpID() {
        return CRMExpressCorpID;
    }

    public void setCRMExpressCorpID(int CRMExpressCorpID) {
        this.CRMExpressCorpID = CRMExpressCorpID;
    }

    @JsonProperty("CRMExpressCorpName")
    public String getCRMExpressCorpName() {
        return CRMExpressCorpName;
    }

    public void setCRMExpressCorpName(String CRMExpressCorpName) {
        this.CRMExpressCorpName = CRMExpressCorpName;
    }

    @JsonProperty("CRMExpressCorpCode")
    public String getCRMExpressCorpCode() {
        return CRMExpressCorpCode;
    }

    public void setCRMExpressCorpCode(String CRMExpressCorpCode) {
        this.CRMExpressCorpCode = CRMExpressCorpCode;
    }

    @JsonProperty("U8_BillID")
    public int getU8_BillID() {
        return U8_BillID;
    }

    public void setU8_BillID(int u8_BillID) {
        U8_BillID = u8_BillID;
    }

    @JsonProperty("U8_BillCode")
    public String getU8_BillCode() {
        return U8_BillCode;
    }

    public void setU8_BillCode(String u8_BillCode) {
        U8_BillCode = u8_BillCode;
    }

    @JsonProperty("cVouchType")
    public String getcVouchType() {
        return cVouchType;
    }

    public void setcVouchType(String cVouchType) {
        this.cVouchType = cVouchType;
    }

    @JsonProperty("cSTCode")
    public String getcSTCode() {
        return cSTCode;
    }

    public void setcSTCode(String cSTCode) {
        this.cSTCode = cSTCode;
    }


    @JsonProperty("cRdCode")
    public String getcRdCode() {
        return cRdCode;
    }

    public void setcRdCode(String cRdCode) {
        this.cRdCode = cRdCode;
    }


    @JsonProperty("cBusType")
    public String getcBusType() {
        return cBusType;
    }

    public void setcBusType(String cBusType) {
        this.cBusType = cBusType;
    }


    @JsonProperty("FactoryID")
    public int getFactoryID() {
        return FactoryID;
    }

    public void setFactoryID(int factoryID) {
        FactoryID = factoryID;
    }

    @JsonProperty("FactoryCode")
    public String getFactoryCode() {
        return FactoryCode;
    }

    public void setFactoryCode(String factoryCode) {
        FactoryCode = factoryCode;
    }

    @JsonProperty("FactoryName")
    public String getFactoryName() {
        return FactoryName;
    }

    public void setFactoryName(String factoryName) {
        FactoryName = factoryName;
    }

    @JsonProperty("DeliveryTime")
    public Calendar getDeliveryTime() {
        return DeliveryTime;
    }

    public void setDeliveryTime(Calendar deliveryTime) {
        DeliveryTime = deliveryTime;
    }

    @JsonProperty("PurchaseOrderID")
    public int getPurchaseOrderID() {
        return PurchaseOrderID;
    }

    public void setPurchaseOrderID(int purchaseOrderID) {
        PurchaseOrderID = purchaseOrderID;
    }

    @JsonProperty("PurchaseOrderCode")
    public String getPurchaseOrderCode() {
        return PurchaseOrderCode;
    }

    public void setPurchaseOrderCode(String purchaseOrderCode) {
        PurchaseOrderCode = purchaseOrderCode;
    }


}
